Skip to content

Conversation

@albertomercurio
Copy link
Member

@albertomercurio albertomercurio commented Dec 14, 2024

Checklist

Thank you for contributing to QuantumToolbox.jl! Please make sure you have finished the following tasks before opening the PR.

  • Please read Contributing to QuantumToolbox.jl.
  • Any code changes were done in a way that does not break public API.
  • Appropriate tests were added and tested locally by running: make test.
  • Any code changes should be julia formatted by running: make format.
  • All documents (in docs/ folder) related to code changes were updated and able to build locally by running: make docs.
  • (If necessary) the CHANGELOG.md should be updated (regarding to the code changes) and built by running: make changelog.

Request for a review after you have completed all the tasks. If you have not finished them all, you can also open a Draft Pull Request to let the others know this on-going work.

Description

The ptrace function was previously returning a CPU array when the input object was a GPU one. That was caused by the mapslice function which doesn't support GPU arrays yet.

Thus, I decided to write the GPU kernel by myself, using KernelAbstractions.jl. This would allow the compatibility with all the GPU arrays, and not only the CUDA arrays.

Moreover, the extension is automatically loaded when CUDA, OneAPI, Metal and the others are loaded, because GPUArrays.jl and KernelAbstractions.jl are direct dependencies of those packages.

@albertomercurio albertomercurio marked this pull request as ready for review December 14, 2024 23:36
@codecov
Copy link

codecov bot commented Dec 14, 2024

Codecov Report

Attention: Patch coverage is 62.50000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 93.18%. Comparing base (3ffdd3d) to head (d9c0fee).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
ext/QuantumToolboxGPUArraysExt.jl 57.14% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #350      +/-   ##
==========================================
- Coverage   93.37%   93.18%   -0.19%     
==========================================
  Files          40       41       +1     
  Lines        2685     2700      +15     
==========================================
+ Hits         2507     2516       +9     
- Misses        178      184       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ytdHuang ytdHuang marked this pull request as draft December 15, 2024 09:24
@ytdHuang ytdHuang marked this pull request as ready for review December 15, 2024 11:00
@ytdHuang ytdHuang marked this pull request as draft December 15, 2024 11:20
@ytdHuang ytdHuang marked this pull request as ready for review December 15, 2024 12:29
@albertomercurio albertomercurio merged commit 1f857be into qutip:main Dec 15, 2024
32 of 36 checks passed
labay11 pushed a commit to labay11/QuantumToolbox.jl that referenced this pull request Dec 22, 2024
* Add `ptrace` support for any `GPUArray`

* Add changelog

---------

Co-authored-by: Yi-Te Huang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants